/*
 * File:   typesFollow.cpp
 * Author: Hadrien
 *
 * Created on 11 juillet 2012, 15:13
 */

#include "typesFollow.h"
//********************* ACTION ********************
FollowAction::FollowAction() {
}

FollowAction::FollowAction(const int& v) {
    m_value = (FollowAction::Actions)v;
}

FollowAction::~FollowAction() {
}

int FollowAction::index() const {
    return m_value;
}
FollowAction::Actions FollowAction::getValue() const {
    return m_value;
}
void FollowAction::setValue(const FollowAction::Actions& v) {
    m_value = v;
}

//********************* STATE ********************

FollowState::FollowState() {
    
}

FollowState::FollowState(const int& v) {
	//Convert to agent position
	m_value.follow1 = (v < 25);
	m_value.posX = v%5 - 2;
	m_value.posY = v/5 - 2;
	if(!m_value.follow1)
	{
		m_value.posY -= 5;
	}
}

FollowState::~FollowState() {
}

int FollowState::index() const {
	int r = m_value.follow1?0:25;
	r += (m_value.posX + 2);
	r += (m_value.posY + 2)*5;
    return r;
}
FollowState::States FollowState::getValue() const {
	return m_value;
}
void FollowState::setValue(const FollowState::States& v) {
    m_value = v;
}

//********************* OBSERVATION ********************
FollowObservation::FollowObservation() {
    m_final = false;
}

FollowObservation::FollowObservation(const int& v) {
    m_final = false;
    m_value = (FollowObservation::Observations)v;
}

FollowObservation::~FollowObservation() {
}

int FollowObservation::index() const {
    return m_value;
}
FollowObservation::Observations FollowObservation::getValue() const {
    return m_value;
}
void FollowObservation::setValue(const FollowObservation::Observations& v) {
    m_value = v;
}

bool FollowObservation::isFinal() const {
    return m_final;
}
void FollowObservation::setFinal(const bool &final) {
    m_final = final;
}
